NES Fire'n'Ice (Solomon's Key 2) data and hacking notes v1.15 (2008-01-05)
--------------------------------------------------------------------------

Notes regarding this document
-----------------------------
 All values are given in hexadecimal notation.

 The information given in this document is likely to contain some errors.

 The Layout and Content data offsets are from a document by Chickenlump.

 English is not my native language, so there may be things that could have
 been worded more clearly.

 If you have corrections or data to contribute, please email them to
 hukka gmail com.


Level data
----------
 Each level is made up of two parts:

 * "Layout" - a bitmask containing the wall layout of the level (1E bytes).

 * "Content" - a block of data containing the initial layout of everything
    else on the level - fire, ice, enemies, pipes etc.

 The format for a Content data block is:

   <Tile ID> <Amount> <Position> <Tile ID> <Amount etc...> ... 00

 * For tile IDs >= 80 (i.e. enemies), only a single position byte follows.
 * A tile ID of zero will signal the end of level data.

 The position byte contains the Y position in the leftmost nybble,
 and the X position in the rightmost nybble.

 Wall tiles are not contained in the Content block since the Layout bitmask
 defines the wall layout.

 Example; a simple level with two flames next to each other at
 locations (05, 0A) and (06, 0A), and a cube of ice at (03, 09):

    0E 02 A5 A6   05 01 93   00
    Flames        Ice        End

 Tile IDs:
 ---------
 02 Ice (straight)
 03 Ice (left end)
 04 Ice (right end)
 05 Ice (single cube)
 06 Pipe (vertical)
 07 Pipe (horizontal)
 08 Pipe (upper right)
 09 Pipe (upper left)
 0A Pipe (lower right)
 0B Pipe (lower left)
 0C Stone
 0D Jar (cold)
 0E Flame
 0F Jar (burning)
 80 Enables upwards scrolling plus lava at bottom
 81 Enemy type A (moves horizontally)
 82 Enemy type B (moves vertically)
 83 Enemy type C (moves vertically, cannot be harmed from above)
 84 Nothing?
 85 Enemy type A, but twice as fast
 86 Enemy type B, but extremely slow
 87 Enemy type C, but twice as fast


Enemy visuals
-------------
 The three enemy types use different graphics depending on the world,
 but always act identically to their respective enemy types.

Worlds 1 - 3
 A = Flying flame
 B = Flying flame
 C = Grey ghost with umbrella (The whole palette is grey)

World 4

 A = Flying flame (if used on level, will turn enemy B into
	 a flying flame too, and enemy C into a glitched flame)
 B = Pink flying ghost
 C = Pink ghost with helmet

World 5

 Same as Worlds 1 - 3

World 6
 A = Black cat-thing
 B = Flapping ghost
 C = Pink ghost, carries ball

World 7
 A = Fish
 B = Flying blob
 C = Pink ghost with horn

World 8
 A = Bird
 B = Bat
 C = Pink ghost with umbrella

World 9
 A = Robed ghost
 B = Tentacled thing
 C = Pink ghost with pitchfork

World 10
 A = Black cat-thing
 B = Flapping ghost
 C = Pink ghost, carries weapon/wand

Worlds 11 - 13
 A = Pink flying teardrop
 B = Pink flying ghost
 C = Pink ghost with helmet

World 14
 Same as World 7

World 15
 Same as World 8


Layout starting locations for each world:
-----------------------------------------
 World 1:  4010
 World 2:  413C
 World 3:  4268
 World 4:  4394
 World 5:  44C0
 World 6:  45EC
 World 7:  4718
 World 8:  4844
 World 9:  4970
 World 10: 4A9C
 World 11: 4BC8
 World 12: 4CF4
 World 13: 4E20
 World 14: 4F4C
 World 15: 5078


Content starting locations for each world:
------------------------------------------
 Two-byte pointers to the actual Content data location for each level in
 the game start at location 6010. To convert this to the proper location
 in the NES ROM file, decrease 4000 from the address and add 10 to
 account for the size of the ROM header.

 World 1:  6010 (-> A12C - 4000 + 10 => ROM location 613C)
 World 2:  6024
 World 3:  6038
 World 4:  604A
 World 5:  6060
 World 6:  6074
 World 7:  6088
 World 8:  609C
 World 9:  60B0
 World 10: 60C4
 World 11: 60D8
 World 12: 60EC
 World 13: 6100
 World 14: 6114
 World 15: 6128


Important tables
----------------
 51A4 - Player start locations (same "YX" nybble format as in level data)
 523A - The amount of flames the player must remove in order to complete
        each level. Do not set this higher than the number of flames
        used in your level. You can set it lower, but the game has a
        glitch where the "flames left to remove" counter at 00AB wraps
		around if you happen to remove more than one flame at once,
		leaving you on an empty level without completing it.


Other data
----------

 Overworld movement

  There are two tables that contain information on how you can move on the
  overworld map. The tables specify which joystick directional buttons will
  take you to the preceding world from the current one, and which buttons
  will take you to the next world. Both tables contain 4-bit bit masks,
  one bit for each direction, in order: Up, Down, Left, Right. So, if you
  want Down and Left to take you from World 2 to World 1, and Up and Right
  to take you to World 3, put %0110 (06) in C826 and %1001 (09) in C81C.

  C81B Table for movement to the next level
  C825 Table for movement to the preceding level

  Other important tables here are the pixel coordinates for the player
  sprite for each world.

  C82F - X pixel locations of different worlds in overworld
  C839 - Y pixel locations of different worlds in overworld

 Level and enemy palettes

  (Bonus worlds use same data as Worlds 1 to 5 respectively.)

  1F1CC - Table of which level palette to use for each world (non-Japanese)
  1F1D7 - Table of which level palette to use for each world (Japanese ver.)
  1F1DB - Table of which enemy palette to use for each world (non-Japanese)
  1F1E6 - Table of which enemy palette to use for each world (Japanese ver.)


Text/Graphics
-------------
 F546 - Top part of game logo ("Fire'N")
 F786 - Bottom part of logo   ("Ice")
 F66A - Bottom of title screen
   F66A - Three lines of text below logo (flashing "PRESS START") (5*16) -> PPU 22A4
   F6B6 - Bottom four lines of text in logo screen (6*16) -> PPU 2304

 5E10  - World palettes
 5EC0  - Overworld palette
 5F30  - Enemy palettes
 CD98  - Color cycle sequence for overworld (3 colors)

 5F10  - Title screen palette
 5FF0  - Title screen background color
 1124C - Title screen colors 5-7 (before color flashing starts)
 1124F - Title screen colors 1-3 (before color flashing starts)
 1B4B4 - Title screen background color (before color flashing starts)

 130E9 - Pointers to text content
 13129 - Pointers to individual dictionary words
 13171 - Dictionary text, each word ending in FA
 13230 - Game text
   A0..C3 = insert word from dictionary
   F8     = new line (must be preceded by some content on same line)
   F9     = clear text area
   FF     = end text
 59E0  - Menu text


Contact
-------
 Email    hukkax@gmail.com
 Website  http://hukka.furtopia.org
